package com.guoyw.dubbo.example;

import com.guoyw.dubbo.member.service.UserService;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;

import java.io.IOException;

/**
 * author: guoyw
 * create: 2020-09-11 17:26
 **/

public class DubboClient{
  public static void main(String[] args) throws IOException{
  
    ApplicationConfig applicationConfig = new ApplicationConfig("young-app");
    ReferenceConfig referenceConfig = new ReferenceConfig();
    referenceConfig.setApplication(applicationConfig);
    referenceConfig.setInterface(UserService.class);
    referenceConfig.setUrl("dubbo://192.168.54.130:20881/com.guoyw.dubbo.member.service.UserService");
    UserService userService = (UserService)referenceConfig.get();
    System.out.println(userService.getUser(1));
  }
}
